<?php
namespace Weixin\Controller;
use Think\Controller;
class BaseController extends Controller{
	/*
     * 初始化操作
     */
    public function _initialize() 
    {
        $action_name = ACTION_NAME;
        //过滤不需要登陆的行为
        if(in_array( $action_name,array('verify','bind','encrypt_data','inquery_eaccount'))){
            //return;
        }else{
            $user = M('User')->where("user_id='%d'",session('uid'))->find();
            if($user == null){
            	 $url = 'http://wxtools.chedai0.com/index.php/Weixin/Index/redirect_url?state=bindUser';
            	 header("Location:$url");
            }else{
            	if(empty($user['eaccount'])){
            		$url = 'http://wxtools.chedai0.com/index.php/Weixin/Index/redirect_url?state=bindUser';
            	 	header("Location:$url");
            	}
            }
        }
    }
}